//
//  KRMacroDefinition.h
//  KRKit
//
//  Created by zhang on 2021/10/25.
//

#ifndef KRMacroDefinition_h
#define KRMacroDefinition_h


#ifdef DEBUG

#define YZLog(...) \NSLog(@"%@第%d行:%@\n---------------------------",[[NSString stringWithFormat:@"%s",__FILE__] componentsSeparatedByString:@"/"][[[NSString stringWithFormat:@"%s",__FILE__] componentsSeparatedByString:@"/"].count-1], __LINE__, [NSString stringWithFormat:__VA_ARGS__]);

#else

#define DLog(...)

#endif

#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif

#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif

#define KR_UIColorFromRGBA(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define KR_RGBA(R,G,B,A)   [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]/*三颜色*/

#define KR_SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height/*获取设备的高度*/
#define KR_SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width/*获取设备的宽度*/

#define KR_IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define KR_IS_IPAD UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
#define KR_IS_iPhone5s (SCREEN_WIDTH >= 320.0f && SCREEN_HEIGHT >= 568.0f && IS_IPHONE)
#define KR_IS_iPhoneX (SCREEN_WIDTH >= 375.0f && SCREEN_HEIGHT >= 812.0f && IS_IPHONE)
//状态栏高度
#define KR_STATUSBAR_HEIGHT  [UIApplication sharedApplication].statusBarFrame.size.height
//导航栏高度
#define KR_NAVIGATIONBAR_HEIGHT 44.f
//tabbar高度
#define KR_TABBAR_HEIGHT (IS_iPhoneX ? (49.f + 34.f) : 49.f)
//tabbarSafeMargin
#define KR_TABBAR_SAfEBOTTOMMARGIN (IS_iPhoneX ? 34.f : 0.f)

#endif /* KRMacroDefinition_h */
